package tn.jee.earProject.beans;



import java.io.Serializable;

import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped;
import javax.faces.bean.ManagedBean;


import tn.jee.earProject.model.Contact;
import tn.jee.earProject.model.Tweet;
/*import tn.enit.jee.tweenit.main.presentation.model.LoginModel;
import tn.enit.jee.tweenit.main.presentation.model.MainModel;
import tn.enit.jee.tweenit.main.presentation.model.TweetInfo;*/

import tn.jee.project.earProjectTweeter.ejb.*;


@ManagedBean(eager = true)
@SessionScoped
public class MainController implements Serializable {

    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@EJB
	private MainModule business;
    private Tweet selectedTweet=new Tweet();
    private Tweet tweet1=new Tweet();
    private String message;
    
    private Contact curentUser;
    
    

    
    
    /*public void connect()
    { 
    try{
        business.authenticate(curentUser.getEmail(), curentUser.getPassword());}
    catch (ValidationException e)
	{
		
		System.out.println("password non valide");
	}
    }*/
    public Tweet getSelectedTweet() {
        return selectedTweet;
    }

    public void setSelectedTweet(Tweet selectedTweet) {
        this.selectedTweet = selectedTweet;
    }

    public void inscrireContact(){
    	business.inscrire(curentUser);
    }
    public Tweet getTweet1() {
        return tweet1;
    }

    public void setTweet1(Tweet tweet1) {
        this.tweet1 = tweet1;
    }

    public MainModule getBusiness() {
        return business;
    }

    public void setBusiness(MainModule business) {
        this.business = business;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

   

    
    
    

   

    public Contact getCurentUser() {
        return curentUser;
    }

    public void setCurentUser(Contact curentUser) {
        this.curentUser = curentUser;
    }

    public MainModule getBuisiness() {
        return business;
    }

    public void setBuisiness(MainModule business) {
        this.business = business;
    }

    /**
     * Creates a new instance of MainController
     */
    public MainController() {
    }

    
 /*   public List<Tweet> getListeTweets(){
         
       // curentUser= loginModel.getContact();
        return business.getTweets(curentUser.getId());
        
    }*/
}

